<extend name="Layout/ins_page" />
<block name="content">
	{:W('PageHeader/adv_search',array('name'=>$folder_name,'search'=>'M'))}
	<form method="post" name="form_adv_search" id="form_adv_search">
		<div class="adv_search panel panel-default  hidden"  id="adv_search">
			<div class="panel-heading">
				<div class="row">
					<h4 class="col-xs-6">高级搜索</h4>
					<div class="col-xs-6 text-right">
						<a  class="btn btn-sm btn-info" onclick="submit_adv_search();">搜索</a>
						<a  class="btn btn-sm " onclick="close_adv_search();">关闭</a>
					</div>
				</div>
			</div>
			<div class="panel-body">
				<div class="form-group col-sm-6">
					<label class="col-sm-4 control-label" for="li_name">标题：</label>
					<div class="col-sm-8">
						<input  class="form-control" type="text" id="li_name" name="li_name" >
					</div>
				</div>
				<div class="form-group col-sm-6">
					<label class="col-sm-4 control-label" for="li_content">内容：</label>
					<div class="col-sm-8">
						<input  class="form-control" type="text" id="li_content" name="li_content" >
					</div>
				</div>
				<div class="form-group col-sm-6">
					<label class="col-sm-4 control-label" for="eq_user_name">登录人：</label>
					<div class="col-sm-8">
						<input  class="form-control" type="text" id="eq_user_name" name="eq_user_name" >
					</div>
				</div>
				<div class="form-group col-sm-6">
					<label class="col-sm-4 control-label" for="be_create_time">登录时间：</label>
					<div class="col-sm-8">
						<div class="input-daterange input-group" >
							<input type="text" class="input-sm form-control text-center" name="be_create_time" readonly="readonly"/>
							<span class="input-group-addon">-</span>
							<input type="text" class="input-sm form-control text-center" name="en_create_time" readonly="readonly"/>
						</div>
					</div>
				</div>
			</div>
		</div>
	</form>
	<div class="space-8"></div>
	<div class="operate panel panel-default">
		<div class="panel-body">
			<div class="pull-left">
				<ul class="nav nav-pills">
					<li <eq name="fid" value="todo">class="active"</eq>>
						<a href="{:U('folder','fid=todo')}">我未接受的任务
						<notempty name="todo_work_order_count">
							<span class="badge badge-pink">{$todo_work_order_count}</span>
						</notempty></a>
					</li>
					<li <eq name="fid" value="my_no_finish">class="active"</eq>>
						<a href="{:U('folder','fid=my_no_finish')}">我已接受的任务
						<notempty name="doing_work_order_count">
							<span class="badge badge-pink">{$doing_work_order_count}</span>
						</notempty></a>
					</li>
					<eq name="auth.admin" value="true">
						<li <eq name="fid" value="my_task">class="active"</eq>>
							<a href="{:U('folder','fid=my_task')}">我发布的任务</a>
						</li>
						<li <eq name="fid" value="all">class="active"</eq>>
							<a href="{:U('folder','fid=all')}">所有任务</a>
						</li>

						<li <eq name="fid" value="no_finish2">class="active"</eq>>
							<a href="{:U('folder','fid=no_finish2')}">所有任务-未完成</a>
						</li>
						<li <eq name="fid" value="finished">class="active"</eq>>
							<a href="{:U('folder','fid=finished')}">所有任务-已完成</a>
						</li>
					</eq>
				</ul>
			</div>
			<if condition="$auth['write']">
				<div class="pull-right">
					<a class="btn btn-sm btn-primary" onclick="add()">发布任务</a>
				</div>
			</if>
		</div>
	</div>
	<div class="ul_table ul_table_responsive">
		<ul>
			<li class="thead">
				<div class="pull-left">
					<span class="col-8 hidden-xs">编号</span>
					<span class="col-6 hidden-xs">发起人</span>
				</div>
				<div class="pull-right">
					<span class="col-6 autocut hidden-xs">执行人</span>
					<span class="col-20 autocut hidden-xs">参与人</span>
					<span class="col-12">要求到达时间</span>
					<span class="col-12">要求完成时间</span>
					<span class="col-6 hidden-xs">状态</span>
					<span class="col-6 text-center hidden-xs">操作</span>
				</div>
				<div class="auto autocut">
					客户
				</div>
			</li>
			<empty name="list">
				<li class="no-data">
					没找到数据
				</li>
				<else/>
				<foreach name="list" item="vo">
					<li class="tbody">
						<div class="pull-left">
							<span class="col-8 hidden-xs">{$vo.task_no}</span>
							<span class="col-6 hidden-xs">{$vo.user_name}</span>
						</div>
						<div class="pull-right">
							<span class="col-6 autocut hidden-xs">&nbsp;{$vo.executor|show_contact}</span>
							<span class="col-20 autocut hidden-xs">&nbsp;{$vo.actor|show_contact}</span>
							<span class="col-12"> <a title="{$vo.arrive_location}" class="<php>
								if(($vo['status']==3) and ($vo['arrive_time'] > $vo['request_arrive_time'])){
								echo("late");
								}</php>"> {$vo.request_arrive_time|substr=0,16}</a></span>
							<span class="col-12"><a title="{$vo.finish_location}" class="<php>
								if(($vo['status']==3) and ($vo['finish_time'] > $vo['request_finish_time'])){
								echo("late");
								}</php>">{$vo.request_finish_time|substr=0,16}&nbsp;</a></span>
							<span class="col-6 hidden-xs">{$vo.status|task_status}&nbsp;</span>
							<span class="col-6 text-center hidden-xs">
								<if condition="($vo.status lt 3) and ($vo.user_id eq $user_id)">
									<a href="{:U('edit','id='.$vo['id'])}">修改</a>&nbsp;<a href="{:U('del','id='.$vo['id'])}">删除</a>
								</if>
								<if condition="($vo.status lt 3) and (strpos($vo['executor'],$user_id)!==false)">
									<a href="{:U('edit2','id='.$vo['id'])}">修改</a>&nbsp;<a href="{:U('del','id='.$vo['id'])}">删除</a>
								</if>								
								</span>
						</div>
						<div class="auto autocut ">
							<a href="{:U('read','id='.$vo['id'])}">{$vo.name}</a>
						</div>
					</li>
				</foreach>
				<div class="pagination">
					{$page}
				</div>
			</empty>
		</ul>
	</div>
</block>
<block name="js">
	<script type="text/javascript">
		function add() {
			window.open("{:U('add')}", "_self");
		}

		$(document).ready(function() {
			set_return_url();
		});
	</script>
</block>
